/*   1:    */ package com.atomikos.icatch.imp;
/*   2:    */ 
/*   3:    */ import com.atomikos.icatch.CompositeTransaction;
/*   4:    */ import com.atomikos.icatch.Participant;
/*   5:    */ import com.atomikos.icatch.RecoveryCoordinator;
/*   6:    */ import com.atomikos.icatch.SubTxAwareParticipant;
/*   7:    */ import com.atomikos.icatch.TxState;
/*   8:    */ import java.util.Stack;
/*   9:    */ 
/*  10:    */ class TxTerminatingStateHandler
/*  11:    */   extends TransactionStateHandler
/*  12:    */ {
/*  13:    */   private boolean committing;
/*  14:    */   
/*  15:    */   public TxTerminatingStateHandler(boolean committing, CompositeTransactionImp ct, TransactionStateHandler handler)
/*  16:    */   {
/*  17: 58 */     super(ct, handler);
/*  18: 59 */     this.committing = committing;
/*  19:    */   }
/*  20:    */   
/*  21:    */   private void reject()
/*  22:    */     throws IllegalStateException
/*  23:    */   {
/*  24: 64 */     if (this.committing) {
/*  25: 65 */       throw new IllegalStateException("Transaction is committing - adding a new participant is not allowed");
/*  26:    */     }
/*  27: 67 */     throw new IllegalStateException("Transaction is rolling back - adding a new participant is not allowed");
/*  28:    */   }
/*  29:    */   
/*  30:    */   protected Object getState()
/*  31:    */   {
/*  32: 74 */     return TxState.ACTIVE;
/*  33:    */   }
/*  34:    */   
/*  35:    */   protected RecoveryCoordinator addParticipant(Participant p)
/*  36:    */   {
/*  37: 79 */     if (!this.committing) {
/*  38: 79 */       reject();
/*  39:    */     }
/*  40: 81 */     return super.addParticipant(p);
/*  41:    */   }
/*  42:    */   
/*  43:    */   protected void addSubTxAwareParticipant(SubTxAwareParticipant p)
/*  44:    */   {
/*  45: 86 */     if (!this.committing) {
/*  46: 86 */       reject();
/*  47:    */     }
/*  48: 88 */     super.addSubTxAwareParticipant(p);
/*  49:    */   }
/*  50:    */   
/*  51:    */   protected void addSynchronizations(Stack s)
/*  52:    */   {
/*  53: 93 */     reject();
/*  54:    */   }
/*  55:    */   
/*  56:    */   protected void commit()
/*  57:    */   {
/*  58: 99 */     reject();
/*  59:    */   }
/*  60:    */   
/*  61:    */   protected CompositeTransaction createSubTransaction()
/*  62:    */   {
/*  63:104 */     reject();
/*  64:105 */     return null;
/*  65:    */   }
/*  66:    */   
/*  67:    */   protected void registerSynchronization()
/*  68:    */   {
/*  69:110 */     reject();
/*  70:    */   }
/*  71:    */   
/*  72:    */   protected void rollbackWithStateCheck()
/*  73:    */   {
/*  74:115 */     if (this.committing) {
/*  75:115 */       reject();
/*  76:    */     }
/*  77:    */   }
/*  78:    */   
/*  79:    */   protected void setRollbackOnly()
/*  80:    */   {
/*  81:123 */     if (this.committing) {
/*  82:125 */       super.setRollbackOnly();
/*  83:    */     }
/*  84:    */   }
/*  85:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.TxTerminatingStateHandler
 * JD-Core Version:    0.7.0.1
 */